﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace SrBBSPro
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //错误页面
            //404
            routes.MapRoute("Error404", "error/404", new { controller = "Error", action = "NotFound" });
            //500
            routes.MapRoute("Error500", "error/500", new { controller = "Error", action = "Error500" });

            //上传图片
            routes.MapRoute("Upload", "user/upload/", new { controller = "Account", action = "Upload" });
            //注销登录
            routes.MapRoute("LogOut", "user/logout/", new { controller = "Account", action = "LogOut" });
            //登录
            routes.MapRoute("Login", "user/login/", new { controller = "Account", action = "Login" });
            //注册
            routes.MapRoute("Register", "user/reg/", new { controller = "Account", action = "Register" });
            //用户中心
            routes.MapRoute("UserIndex", "user/", new { controller = "Account", action = "Index" });         
            //帐号设置
            routes.MapRoute("Set", "user/set/", new { controller = "Account", action = "Set" });
            //我的消息
            routes.MapRoute("Message", "user/msg", new { controller = "Account", action = "Message" });
            //修改密码
            routes.MapRoute("Repass", "user/repass", new { controller = "Account", action = "Repass" });
            //用户主页
            routes.MapRoute("UserHome", "user/Home", new { controller = "Account", action = "Home" });            
            //@搜索
            routes.MapRoute("SearchJump", "jump/{StaffName}", new { controller = "Account", action = "Jump" });


            //消息相关 API
            //用户主页
            //获取个人消息
            routes.MapRoute("MessageGet", "api/msg/", new { controller = "Message", action = "Get" });
            //获取未读消息总数 
            routes.MapRoute("MessageCount", "msg/msgcount/", new { controller = "Message", action = "MsgCount" });
            //将消息设置为已读 
            routes.MapRoute("MessageRead", "msg/read/", new { controller = "Message", action = "MsgRead" });
            //我的求解 
            routes.MapRoute("MessageMinePost", "post/minepost/", new { controller = "Post", action = "MinePost" });
            //删除一条消息 
            routes.MapRoute("MessageDel", "api/msg-del/", new { controller = "Message", action = "MsgDel" });
            //上传图片 
            routes.MapRoute("PostUpload", "post/upload/", new { controller = "Post", action = "Upload" });
            //删除帖子 
            routes.MapRoute("PostDelete", "post/delete/", new { controller = "Post", action = "Delete" });
            //帖子设置 
            routes.MapRoute("PostSet", "post/set/", new { controller = "Post", action = "Set" });
            //赞帖子 
            routes.MapRoute("PostLike", "post/Like/", new { controller = "Post", action = "Like" });
            //删除评论
            routes.MapRoute("PostDelComment", "post/delComment/", new { controller = "Post", action = "DelComment" });

            //帖子相关
            //帖子采纳
            routes.MapRoute("PostAccept", "post/accept/", new { controller = "Post", action = "Accept" });
            //回帖
            routes.MapRoute("PostReply", "post/reply/", new { controller = "Post", action = "Reply" });
            //未结贴
            routes.MapRoute("PostUnsolved", "post/unsolved/", new { controller = "Post", action = "Unsolved" });
            //未结贴 -- 分页
            routes.MapRoute("PostUnsolvedPage", "post/unsolved_page_{pageIndex}", new { controller = "Post", action = "Unsolved" });
            //已采纳
            routes.MapRoute("PostSolved", "post/solved/", new { controller = "Post", action = "Solved" });
            //已采纳 -- 分页
            routes.MapRoute("PostSolvedPage", "post/solved_page_{pageIndex}", new { controller = "Post", action = "Solved" });
            //帖子主页
            routes.MapRoute("PostHome", "post/", new { controller = "Post", action = "Index" });
            //帖子列表-分页
            routes.MapRoute("PostHomePage", "post/page_{pageIndex}", new { controller = "Post", action = "Index" });
            //查询帖子
            routes.MapRoute("PostSearch", "post/search/", new { controller = "Post", action = "Search" });
            //发布帖子
            routes.MapRoute("PostAdd", "post/add", new { controller = "Post", action = "Add" });
            //编辑帖子
            routes.MapRoute("PostEdit", "post/edit_{postId}", new { controller = "Post", action = "Edit" });
            //精贴
            routes.MapRoute("PostWonderful", "post/wonderful/", new { controller = "Post", action = "Wonderful" });
            //精贴 - 分页
            routes.MapRoute("PostWonderfulPage", "post/wonderful_page_{pageIndex}", new { controller = "Post", action = "Wonderful" });
            //查看帖子详情
            routes.MapRoute("PostDetail", "post/{postId}", new { controller = "Post", action = "Detail" });
            
            //统计
            //统计一览
            routes.MapRoute("CountList", "count", new { controller = "Count", action = "Index" });
            routes.MapRoute("CountAdd", "count/add", new { controller = "Count", action = "Add" });
            routes.MapRoute("CountAllList", "count/alllist", new { controller = "Count", action = "AllList" });

            //工程
            routes.MapRoute("ProjectHome", "project/", new { controller = "Project", action = "Index" });
            routes.MapRoute("ProjectAdd", "project/add", new { controller = "Project", action = "Add" });
            routes.MapRoute("ProjectDetail", "project/detail", new { controller = "Project", action = "Detail" });
            routes.MapRoute("ProjectMember", "project/member", new { controller = "Project", action = "Member" });
            routes.MapRoute("ProjectBug", "project/bug", new { controller = "Project", action = "Bug" });
            routes.MapRoute("ProjectBugInfo", "project/buginfo", new { controller = "Project", action = "BugInfo" });
            routes.MapRoute("ProjectPageList", "project/pageList", new { controller = "Project", action = "PageList" });

            //技能
            routes.MapRoute("SkillHome", "skill/", new { controller = "Skill", action = "Index" });
            routes.MapRoute("SkillDetail", "skill/detail", new { controller = "Skill", action = "Detail" });

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
            );
        }
    }
}
